<?php

/**
 * @author edson
 * @copyright 2011
 */

//echo "registrar ....";
//echo getcwd();
//echo basename(getcwd());

$ruta=$_SERVER['DOCUMENT_ROOT']."/viventura"."/MDAdministracion";
$ruta2=$_SERVER['DOCUMENT_ROOT']."/viventura";
include_once("$ruta/conf/CConfig.php");
include_once("$ruta/elements/head.tpl");
include_once("$ruta/view/CDrawPage.php");
include_once("$ruta/view/CDrawPageReg.php");
/*SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'hoteles'
AND table_schema = 'viv2'*/
if(!isset($_GET['codigo']))// acceso a un dato 
{
$action="SaveRegister.php";$name="formulario_registro";$method="post";$NAME="REGISTRO De HOTEL";
CDrawPageReg::getInstance()->DrawHead($action,$name,$method,$NAME);//dibujmos la cabezera del formulario 


$items=array("nombre"=>"Nombre","nomcontacto"=>"Nombre de Contacto","apellcontacto"=>"Apellido de Contacto",
"limite"=>"Límite de Pasajeros","limitebloqueo"=>"Límite de Bloqueo",
"fax"=>"Número de Fax","postal"=>"Código Postal","Mail"=>"Mail",
"web"=>"Web Site","dirección"=>"Dirección","PhoHot" =>"foto", 	"MovHot"=>"Mov", 	"FaxHot"=>"fax", 	
   		 	"LimResHot" =>"limitr"	,
	"Hotsimple"=>"simple" ,	"HotDoble"=>"doble" ,	"HotMat"=>"matrimonial", 	"HotTrip"=>"triple");
//CDrawPageReg::getInstance()->DrawTextBoxHidden("tabla"=>"trabajadores");
CDrawPageReg::getInstance()->DrawTextBox($items);
//$item=array("trabajadores"=>"trabajadores");
//CDrawPage::getInstance()->DrawTextBox($item,"hidden");
//CDrawPageReg::getInstance()->DrawinputDate("inputDate","born");

/*----------------------------------------------------------------------------------/
*                                       COMBOBOX
*----------------------------------------------------------------------------------*/
echo "<div id='dashboard_info'>";
$NAMEbox="CIUDADES";
$campos_table=array("idCit","NamCit","CouNameCit");
$table="city";
CDrawPageReg::getInstance()->DrawSelect($table,$campos_table,$NAMEbox);
echo "</div>";




}
else
{
/*---------------------------------------------------------------------------------*/
//                                  actualizar
/*--------------------------------------------------------------------------------*/
    
    $code=$_GET['codigo'];
    $cadena="select * from hoteles where idHot=$code";
    $update=CModelo::getInstance()->getData($cadena);
    //var_dump($update);
    $action="SaveRegister.php";$name="formulario_registro";$method="post";$NAME="REGISTRO de Hotel";
    CDrawPageReg::getInstance()->DrawHead($action,$name,$method,$NAME);//dibujmos la cabezera del formulario 
//nombre en la base de dstos de los campos 
	$items=array("idHot"=>"idHot" ,	"NamHot"=>"Nombre" ,"FirstConHot"=>"Nombre del Contacto" ,"LastConHot"=>"Apellido del Contacto" ,"LimBloqHot"=>"Limite de Bloqueo", "PosCodHot"=>"Código Postal", "MailHot"=>"Mail", 
    "WebPageHot"=>"Web Site" ,"DirHot"=>"Dirección","PhoHot" =>"foto", 	"MovHot"=>"Mov", 	"FaxHot"=>"fax", 	
   		 	"LimResHot" =>"limitr"	,
	"Hotsimple"=>"simple" ,	"HotDoble"=>"doble" ,	"HotMat"=>"matrimonial", 	"HotTrip"=>"triple"    
   ); 
   //items=array("nombre"=>"Nombre","nomcontacto"=>"Nombre de Contacto","apellcontacto"=>"Apellido de Contacto","limite"=>"Límite de Pasajeros","limitebloqueo"=>"Límite de Bloqueo","fax"=>"Número de Fax","postal"=>"Código Postal","Mail"=>"Mail","web"=>"Web Site","dirección"=>"Dirección");
//CDrawPageReg::getInstance()->DrawTextBoxHidden("tabla"=>"trabajadores");
    CDrawPageReg::getInstance()->DrawTextBox($items,$update);
    $item=array("hoteles"=>"hoteles");
    CDrawPage::getInstance()->DrawTextBox($item,"hidden");
    //CDrawPageReg::getInstance()->DrawinputDate("inputDate","born");
    //CDrawPageReg::getInstance()->DrawinputDate("inpDa","asd");

/*----------------------------------------------------------------------------------/
*                                       COMBOBOX
*----------------------------------------------------------------------------------*/
    echo "<div id='dashboard_info'>";
    $id=$update[0]['CITY_idCit'];
    echo $id;
    $NAMEbox="CIUDADES";
    $campos_table=array("idCit","NamCit","CouNameCit");
    $table="city";
    CDrawPageReg::getInstance()->DrawSelect($table,$campos_table,$NAMEbox,$id);
//echo time();
    //$NAMEbox="OFICINA";
    //$campos_table2=array("idOfi","DirOfi");
    //$table2="oficinas";
    //$id=$update[0]['OFICINAS_idOfi'];
    //CDrawPageReg::getInstance()->DrawSelect($table2,$campos_table2,$NAMEbox,$id);   
    echo "</div>";


    /*$NAMEbox="PERFIL DE USUARIO ";
    $campos_table2=array("idPer","nomPer");
    $table2="perfiles";
    $id=$update[0]['perfiles_idPer'];
    CDrawPageReg::getInstance()->DrawSelect($table2,$campos_table2,$NAMEbox,$id);
*/
/*
$items=array("HOMBRE"=>"h","MUJER"=>"m");
$sex=$update[0]['SexTra'];
CDrawPageReg::getInstance()->DrawRadioButton($items,"SEXO",$sex);
*/
CDrawPageReg::getInstance()->DrawSubmmit("Actualizar");
CDrawPageReg::getInstance()->DrawFoot();
    
}
/*------------------------------------------------------------------------------*/
//                                  actualizar
/*------------------------------------------------------------------------------*/

include_once("$ruta/elements/foot.tpl");


?>